#region License Revision: 0 Last Revised: 6/18/2008 11:00 AM
/******************************************************************************
Copyright (c) Microsoft Corporation.  All rights reserved.


This file is licensed under the Microsoft Public License (Ms-PL). A copy of the Ms-PL should accompany this file. 
If it does not, you can obtain a copy from: 

http://www.microsoft.com/resources/sharedsource/licensingbasics/publiclicense.mspx
******************************************************************************/
#endregion // License
using System;
using System.Windows.Browser;
using System.Diagnostics;
using ScriptInterop;

namespace VIEWS // Virtual Earth Wrapper
{

public class VETileSourceSpecification : JSObject
{
	/// <summary>String holding JavaScript class name</summary>
	private static string thisClass = "VETileSourceSpecification";
	
	/// <summary>Get the JavaScript class name</summary>
	/// <returns type="String">The class name used in JavaScript </returns>		
	public override string ClassName
	{
		get { return thisClass; }
	}

	/// <summary>Construct a C# wrapper from a ScriptObject</summary>
	/// <param name="so">A ScriptObjet from JScript.</param>
	public VETileSourceSpecification(ScriptObject so) : base(so) { }

	/// <summary>Initializes a new instance of the VETileSourceSpecification object.</summary>
	/// <param name="tileSourceId" type="Number">A unique identifier for the layer. Each layer on a map must have a unique Identifier. Required.</param>
	/// <param name="tileSource" type="String">The location of the tiles. Required.</param>
	public VETileSourceSpecification(int tileSourceId, string tileSource) 
	{
		ScriptObject = CreateClass(tileSourceId, tileSource);
	}
	
	/// <summary>Initializes a new instance of the VETileSourceSpecification object.</summary>
	/// <param name="tileSourceId" type="Number">A unique identifier for the layer. Each layer on a map must have a unique Identifier. Required.</param>
	/// <param name="tileSource" type="String">The location of the tiles. Required.</param>
    /// <param name="servers" type="Number">The number of servers on which the tiles are hosted. Optional. The default value is 1.</param>
	public VETileSourceSpecification(int tileSourceId, string tileSource, int servers) 
	{
		ScriptObject = CreateClass(tileSourceId, tileSource, servers);
	}
	
	/// <summary>Initializes a new instance of the VETileSourceSpecification object.</summary>
	/// <param name="tileSourceId" type="Number">A unique identifier for the layer. Each layer on a map must have a unique Identifier. Required.</param>
	/// <param name="tileSource" type="String">The location of the tiles. Required.</param>
    /// <param name="servers" type="Number">The number of servers on which the tiles are hosted. Optional. The default value is 1.</param>
	/// <param name="bounds" type="Array">An array of VELatLongRectangle Class objects that specifies the approximate coverage area of the layer. Optional.</param>
	public VETileSourceSpecification(int tileSourceId, string tileSource, int servers, VELatLongRectangle[] bounds) 
	{
		JSArray<ScriptObject> arrRect = ConvertToScriptObjectJSArray(bounds);
		ScriptObject = CreateClass(tileSourceId, tileSource, servers, (ScriptObject)arrRect);
	}
	
	/// <summary>Initializes a new instance of the VETileSourceSpecification object.</summary>
	/// <param name="tileSourceId" type="Number">A unique identifier for the layer. Each layer on a map must have a unique Identifier. Required.</param>
	/// <param name="tileSource" type="String">The location of the tiles. Required.</param>
    /// <param name="servers" type="Number">The number of servers on which the tiles are hosted. Optional. The default value is 1.</param>
	/// <param name="bounds" type="Array">An array of VELatLongRectangle Class objects that specifies the approximate coverage area of the layer. Optional.</param>
	/// <param name="minZoom" type="Number">The minimum zoom level at which to display the custom tile source. Optional.</param>
	public VETileSourceSpecification(int tileSourceId, string tileSource, int servers, VELatLongRectangle[] bounds, int minZoom) 
	{
		JSArray<ScriptObject> arrRect = ConvertToScriptObjectJSArray(bounds);
		ScriptObject = CreateClass(tileSourceId, tileSource, servers, (ScriptObject)arrRect, minZoom);
	}
	
	/// <summary>Initializes a new instance of the VETileSourceSpecification object.</summary>
	/// <param name="tileSourceId" type="Number">A unique identifier for the layer. Each layer on a map must have a unique Identifier. Required.</param>
	/// <param name="tileSource" type="String">The location of the tiles. Required.</param>
	/// <param name="servers" type="Number">The number of servers on which the tiles are hosted. Optional. The default value is 1.</param>
	/// <param name="bounds" type="Array">An array of VELatLongRectangle Class objects that specifies the approximate coverage area of the layer. Optional.</param>
	/// <param name="minZoom" type="Number">The minimum zoom level at which to display the custom tile source. Optional.</param>
	/// <param name="maxZoom" type="Number">The maximum zoom level at which to display the custom tile source. Optional.</param>
	public VETileSourceSpecification(int tileSourceId, string tileSource, int servers, VELatLongRectangle[] bounds, int minZoom, int maxZoom) 
	{
		JSArray<ScriptObject> arrRect = ConvertToScriptObjectJSArray(bounds);
		ScriptObject = CreateClass(tileSourceId, tileSource, servers, (ScriptObject)arrRect, minZoom, maxZoom);
	}
	
	/// <summary>Initializes a new instance of the VETileSourceSpecification object.</summary>
	/// <param name="tileSourceId" type="Number">A unique identifier for the layer. Each layer on a map must have a unique Identifier. Required.</param>
	/// <param name="tileSource" type="String">The location of the tiles. Required.</param>
	/// <param name="servers" type="Number">The number of servers on which the tiles are hosted. Optional. The default value is 1.</param>
	/// <param name="bounds" type="Array">An array of VELatLongRectangle Class objects that specifies the approximate coverage area of the layer. Optional.</param>
	/// <param name="minZoom" type="Number">The minimum zoom level at which to display the custom tile source. Optional.</param>
	/// <param name="maxZoom" type="Number">The maximum zoom level at which to display the custom tile source. Optional.</param>
	/// <param name="getTilePath" type="String">When viewing a map in 2D mode, the function that determines the correct file names for the tiles. Optional.</param>
	public VETileSourceSpecification(int tileSourceId, string tileSource, int servers, VELatLongRectangle[] bounds, int minZoom, int maxZoom, string getTilePath) 
	{
		JSArray<ScriptObject> arrRect = ConvertToScriptObjectJSArray(bounds);
		ScriptObject = CreateClass(tileSourceId, tileSource, servers, (ScriptObject)arrRect, minZoom, maxZoom, getTilePath);
	}
	
	/// <summary>Initializes a new instance of the VETileSourceSpecification object.</summary>
	/// <param name="tileSourceId" type="Number">A unique identifier for the layer. Each layer on a map must have a unique Identifier. Required.</param>
	/// <param name="tileSource" type="String">The location of the tiles. Required.</param>
	/// <param name="servers" type="Number">The number of servers on which the tiles are hosted. Optional. The default value is 1.</param>
	/// <param name="bounds" type="Array">An array of VELatLongRectangle Class objects that specifies the approximate coverage area of the layer. Optional.</param>
	/// <param name="minZoom" type="Number">The minimum zoom level at which to display the custom tile source. Optional.</param>
	/// <param name="maxZoom" type="Number">The maximum zoom level at which to display the custom tile source. Optional.</param>
	/// <param name="getTilePath" type="String">When viewing a map in 2D mode, the function that determines the correct file names for the tiles. Optional.</param>
	/// <param name="opacity" type="Number">The opacity level of the tiles when displayed on the map. 0.0 to 1.0. Optional.</param>
	public VETileSourceSpecification(int tileSourceId, string tileSource, int servers, VELatLongRectangle[] bounds, int minZoom, int maxZoom, string getTilePath, double opacity) 
	{
		JSArray<ScriptObject> arrRect = ConvertToScriptObjectJSArray(bounds);
		ScriptObject = CreateClass(tileSourceId, tileSource, servers, arrRect, minZoom, maxZoom, getTilePath, opacity);
	}
	
	/// <summary>Initializes a new instance of the VETileSourceSpecification object.</summary>
	/// <param name="tileSourceId" type="Number">A unique identifier for the layer. Each layer on a map must have a unique Identifier. Required.</param>
	/// <param name="tileSource" type="String">The location of the tiles. Required.</param>
	/// <param name="servers" type="Number">The number of servers on which the tiles are hosted. Optional. The default value is 1.</param>
	/// <param name="bounds" type="Array">An array of VELatLongRectangle Class objects that specifies the approximate coverage area of the layer. Optional.</param>
	/// <param name="minZoom" type="Number">The minimum zoom level at which to display the custom tile source. Optional.</param>
	/// <param name="maxZoom" type="Number">The maximum zoom level at which to display the custom tile source. Optional.</param>
	/// <param name="getTilePath" type="String">When viewing a map in 2D mode, the function that determines the correct file names for the tiles. Optional.</param>
	/// <param name="opacity" type="Number">The opacity level of the tiles when displayed on the map. 0.0 to 1.0. Optional.</param>
	/// <param name="zIndex" type="Number">The z-index value for the tiles. Optional.</param>
	public VETileSourceSpecification(int tileSourceId, string tileSource, int servers, VELatLongRectangle[] bounds, int minZoom, int maxZoom, string getTilePath, double opacity, int zIndex) 
	{
		JSArray<ScriptObject> arrRect = ConvertToScriptObjectJSArray(bounds);
		ScriptObject = CreateClass(tileSourceId, tileSource, servers, arrRect, minZoom, maxZoom, getTilePath, opacity, zIndex);
	}
	
	/// <summary name="Bounds" type="Array">An array of VELatLongRectangle Class objects that specifies the approximate coverage area of the layer.</summary>
	public VELatLongRectangle[] Bounds
	{
		get
		{
			ScriptObject so = GetProperty<ScriptObject>("Bounds");
			JSArray<ScriptObject> arrRect = new JSArray<ScriptObject>(so);
			VELatLongRectangle[] arrayLatLongRectangle = new VELatLongRectangle[arrRect.Length];
			for(int i=0;i < arrRect.Length;i++)
			{
				arrayLatLongRectangle[i] = new VELatLongRectangle(arrRect[i]);
			}
			return arrayLatLongRectangle;
		}
		set
		{
			JSArray<ScriptObject> arrRect = ConvertToScriptObjectJSArray(value);
			SetProperty("Bounds", (ScriptObject)arrRect); 
		}
	}
	/// <summary name="Id" type="Number">The unique identifier for the layer. Each tile layer on a map must have a unique ID.</summary>
	public int Id
	{
		get { return GetProperty<int>("ID"); }
		set { SetProperty("ID", value); }
	}
	/// <summary name="MaxZoom" type="Number">The maximum zoom level at which to display the custom tile source.</summary>
	public int MaxZoom
	{
		get { return GetProperty<int>("MaxZoom"); }
		set { SetProperty("MaxZoom", value); }
	}
	/// <summary name="MinZoom" type="Number">The minimum zoom level at which to display the custom tile source.</summary>
	public int MinZoom
	{
		get { return GetProperty<int>("MinZoom"); }
		set { SetProperty("MinZoom", value); }
	}
    /// <summary name="Servers" type="Number">The number of servers on which the tiles are hosted.</summary>
	public int Servers
	{
		get { return GetProperty<int>("NumServers"); }
		set { SetProperty("NumServers", value); }
	}
	/// <summary name="Opacity" type="Number">Specifies the opacity level of the tiles when displayed on the map. 0.0 to 1.0.</summary>
	public double Opacity
	{
		get { return GetProperty<double>("Opacity"); }
		set { SetProperty("Opacity", value); }
	}
	/// <summary name="TileSource" type="String">The location of the tiles.</summary>
	public string TileSource
	{
		get { return GetProperty<string>("TileSource"); }
		set { SetProperty("TileSource", value); }
	}
	
	/// <summary name="ZIndex" type="Number">Specifies the z-index for the tiles.</summary>
	public int ZIndex
	{
		get { return GetProperty<int>("ZIndex"); }
		set { SetProperty("ZIndex", value); }
	}
}

}
